list1 = []
list2 = list()
list3 = [1,2,3,4,5]
print(list3)
for i in list3:
    print(i , end=' ')
print('  ')
print(list[0])
print(list3[-1])
print(list3[-2])
print(list3[:3])
print(list3[2:])
print(list3[::2])
print(list3[::-1])

list3.append(6)
print(list3)
list3.insert(0,0)
print(list3)
list3.insert(7,8)
print(list3)

list4 = [11,5,3,22,66,1,9]
list4.sort()
list4.reverse()
print(list4)

list4 = sorted(list4)
print(list4)


print(list3)
list3.pop()
print(list3)
list3.pop(2)
print(list3)
list3.remove(5)
print(list3)
#list3.clear()
#print(list3)

list3[0] = 100

#列表推导式
list5 = [i for i in list4 if i % 2 == 0]
print(list5)


tuple1 = ()
tuple2= (1)
tuple3 =()
print(tuple3)
for i in tuple3:
    print(i, end=' ')
print(tuple3[0])
print(tuple3[-1])
print(tuple3[1:4])
print(tuple3[:3])
print(tuple3[::2])


#集合
set1 = set([1,2,3,4,5,3,7,4,1])
print(set1)
set1.pop()
print(set1)
set1.remove(5)
print(set1)
set1.discard(2)
print(set1)



#字典
dict0 = {}
dict1 = dict()
dict2 = {'name':'张三','age':18,'sex':'男'}
print(dict2)
print(dict2['name'])
print(dict2['age'])
for key,value   in dict2.items():
    print(key,value)

for key in dict2.keys():
    print(key)

    print(dict2.get('id','没有相关数据'))
    print(dict2.get('id2','没有相关数据'))

dict2['id'] = 100
print(dict2)
dict2['id'] = 101
print(dict2)

dict2.update({'id':102,'sex':'女'})


dict2.pop('id')
print(dict2)
item = dict2.popitem()
print(item)
print(type(item))
print(dict2)
dict2.clear()
print(dict2)



list8 = [1,2,3]
list9 = [4,5,6]
print(list8+list9)

print("*"*10)
print(list8*3)

tuple4 = (1,2,3)
print(tuple4*3)
print(tuple4+tuple4)

print(1 in list8)
print(111 in list9)
print(1 not in list8)
print(111 not in list9)